# -*- coding: utf-8 -*-
# @Time : 2022-06-15 11:01
# @Author : Z
# @Function : 函数的参数列表
import os
import jpype

def func(a, b, *args, c=1, d=2, **kwargs):
    """
    1、a，b为必填参数，切要按照顺序填写
    2、*args选填元组参数，可以不填，规范上必须要在选填参数前面，凡是没有p=等于的形式传递的参数，都会放到args元组里面
    3、c=5，d=6选填参数（键值对参数），可以填，可以不填，不填就是用默认值
    4、**kwargs选填字典参数，p=1的形式传传递的参数，都会放到kwargs字典里面
    """
    print(a)
    print(b)
    print(c,d)
    print(args)
    print(kwargs)


func("1", "2", 3, 4, c=5, d=6, e=7, f=8, g=9)


def func_dit(**kwargs):
    ll = {}
    for key in kwargs.keys():
        ll[key] = kwargs.get(key)
    return ll


print(func_dit(a=1, b=2, c=3, d=4, p='pp', l='123'))

jdkpath = os.environ['JAVA_HOME']
print(jdkpath)

# 启动jvm，加载jar
jpype.startJVM(jdkpath + "/jre/bin/server/jvm.dll", convertStrings=False)

jpype.java.lang.System.out.println('hello world!')
jpype.java.lang.System.out.println('llllllllllllllll')
jpype.shutdownJVM()


def func(*name):
    print(type(name))
    print(name)


func(1, 4, 6)
func(5, 6, 7, 1, 2, 3)


def funA(**dict):
    print(type(dict))
    print(dict)


funA(c=1, a=2, d=3)

# p = [i for i in range(10)]
# for i in range(10):
#     p.append(i)
# print(p)

# 指针传参
# 列表也可以*p传参
p = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]


def func2(a, b, c, *args):
    print(a, b, c)
    print(args)


func2(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
func2(*p)


def func3(**kwargs):
    print(kwargs)


# 字典也可以这样子传参
dict_ll = {"a": "1", "b": "2", "c": "3"}
func3(**dict_ll)
func3(a=2,b=3,c=3,d=5)


dict(one=1, two=2)
print(dict)

